/**
 * 
 */
package com.ez.supervise.service.impl;

import java.util.List;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.OrgDemocracyDao;
import com.ez.supervise.model.biz.OrgDemocracy;
import com.ez.supervise.service.OrgDemocracyService;

/**
 * @author searph.wang
 * @email searph.wang@gmail.com
 * @Created at 2009-7-22
 * 
 */
public class OrgDemocracyServiceImpl implements OrgDemocracyService {
    private OrgDemocracyDao orgDemocracyDao;

    // public int update(OrgDemocracy org) {
    // return sqlMapClientTemplate.update("sys.updateOrgDemocracy", org);
    // }

    public void setOrgDemocracyDao(OrgDemocracyDao orgDemocracyDao) {
	this.orgDemocracyDao = orgDemocracyDao;
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#delete(java.lang.Long)
     */
    public void delete(Long id) {
	orgDemocracyDao.delete(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#insert(java.lang.Object)
     */
    public void insert(Object entity) {
	orgDemocracyDao.insert(entity);

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#update(java.lang.Object)
     */
    public void update(Object entity) {
	orgDemocracyDao.update(entity);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.base.BaseService#get(java.lang.Long)
     */
    public Object get(Long id) {
	return (OrgDemocracy) orgDemocracyDao.get(id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.ez.supervise.service.OrgDemocracyService#findByPage(com.ez.supervise.core.
     * Page)
     */
    public Page findByPage(Page page) {
	page.setRoot(orgDemocracyDao.findByPage(page));
	page.setTotalProperty(orgDemocracyDao.findByCount(page));
	return page;

    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.service.OrgDemocracyService#findAll()
     */
    public List findAll() {
	return orgDemocracyDao.findAll();
    }

    /* (non-Javadoc)
     * @see com.ez.supervise.service.OrgDemocracyService#saveOrgDemocracy(java.util.List)
     */
    public void saveOrgDemocracy(List<OrgDemocracy> dataList) {
	for (OrgDemocracy orgDemocracy : dataList) {
	    orgDemocracyDao.insert(orgDemocracy);
	}
    }

    /* (non-Javadoc)
     * @see com.ez.supervise.service.OrgDemocracyService#queryDemocracy(java.lang.Integer, java.lang.String, java.lang.String, java.lang.Long)
     */
    public List queryDemocracy(Integer year, String orgType, String queryType, Long checkManId) {
	return  orgDemocracyDao.queryDemocracy(year,orgType, queryType, checkManId);
    }

    /* (non-Javadoc)
     * @see com.ez.supervise.service.OrgDemocracyService#countOrgDemocracy(java.lang.Integer, java.lang.Long)
     */
    public int countOrgDemocracy(Integer year, Long userId) {
	return orgDemocracyDao.countOrgDemocracy(year,userId);
    }
}
